#@layoutT("OA消息管理")
#define main()
	#@formStart()
		#@queryStart('code')
		   <input type="search" name="MESS_USER" autocomplete="off" class="layui-input" placeholder="消息来源用户"/>
		#@queryEnd()
		#@queryStart('name')
		   <input type="search" name="MESSD_MESSAGE_DATA" autocomplete="off" class="layui-input" placeholder="消息内容"/>
		#@queryEnd()
		#@queryStart('状态')
			<select name="MESSD_STATUS" class="layui-input" lay-search>
				<option value="">---状态---</option>
				<option value="0">未发送</option>
				<option value="1">已发送</option>
				<option value="-1">用户无效</option>
			</select>
		#@queryEnd()		
	#@formEnd()
	
	<div class="layui-row  f-index-toolbar">
			<div class="layui-col-xs12">
   				<table id="maingrid" lay-filter="maingrid"></table>
   			</div>
   	</div>
   	<!-- 表头工具栏 -->
   	<script type="text/html" id="table_toolbar">
  		<div class="layui-btn-group">
			#if(vs.funcMap.get('oa_message_delete'))					
				<button class="layui-btn  layui-btn-normal layui-btn-sm" lay-event="delete">
				  <i class="layui-icon">&#xe640;</i> 删除
				</button>		
			#end				
				<button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="refresh">
				  <i class="layui-icon">&#xe669;</i> 刷新
				</button>
		</div>
	</script>
   	<!-- 	每行的操作按钮 static/libs/common/grid-init.js layEvent === 'send'-->
	<script type="text/html" id="bar_maingrid">	
	#if(vs.funcMap.get('oa_message_send'))
  		<a class="layui-btn layui-btn-xs" lay-event="send">发送</a>
	#end
	#if(vs.funcMap.get('oa_message_delete'))
  		<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
	#end
	</script>
#end

#define js()
<!-- 分页表格 -->
<script>
	 function userRole(obj){
		 var data=obj.data;
		var userCode=data.user_code;
		var userName=data.user_name;
		var url="#(path)/portal/core/sysUser/userRole?userCode="+userCode+"&userName="+userName;
		openDialog("配置用户角色",url,false,null,null);
	 }
	 

	gridArgs.title='oa协同消息';
	gridArgs.dataId='RKEY';
	gridArgs.sendUrl='#(path)/portal/meiko/oa/id_deadline/send';
	gridArgs.deleteUrl='#(path)/portal/meiko/oa/id_deadline/delete';
	gridArgs.gridDivId ='maingrid';
	gridArgs.heightDiff=54;//调整表格高度
	initGrid({id : 'maingrid'
			,elem : '#maingrid'
			,cellMinWidth: 80
			,toolbar:'#table_toolbar'			
			,cols : [ [
					{title: '主键',field : 'RKEY',width : 35,checkbox : true},						
					{title:'序号',type:'numbers',width:35},
					{title: '消息来源工厂', field: 'MESS_FACT' },
					{title: '消息来源编号', field: 'MESS_SOURID'},
        			{title: '消息来源系统', field: 'MESS_SYSTEM'},
	        		{title: '消息来源用户', field: 'MESS_USER'},
	        		{title: '消息来源时间', field: 'MESS_DT'},
	        		{title: '用户/分组', field: 'MESSD_UG',templet:'#ug'},
	        		{title: '接收对象', field: 'MESSD_RECIPIENT'},
	        		{title: '消息内容', field: 'MESSD_MESSAGE_DATA'},
	        		{title: '消息链接', field: 'MESSD_MESSAGE_LINK'},
	        		{title: '状态', field: 'MESSD_STATUS',templet:'#status'},
					{title: '操作',fixed:'right',width : 160,align : 'left',toolbar : '#bar_maingrid'} // 这里的toolbar值是模板元素的选择器
			] ]
			,url:"#(path)/portal/meiko/oa/id_deadline/list"
			,searchForm : 'searchForm'
		});
	
</script>
<script type="text/html" id="status">
    {{ d.MESSD_STATUS == '1' ? '已发送' :d.MESSD_STATUS == '0'?'未发送':'用户无效'}}             
</script>
<script type="text/html" id="ug">
    {{ d.MESSD_UG == 'U'||d.MESSD_UG == 'u' ? '用户' : '分组' }}             
</script>
#end

 
 